import javax.swing.*;
import java.awt.*;

public class Window extends JPanel{
//    public void paint(Graphics g) {
//        super.paint(g);//调用父类的画画方法 - 清除运动轨迹
//        /* 设置字体大小/字体颜色 */
//        Font font = new Font("微软雅黑", Font.BOLD, 25);
//        g.setFont(font);
//        //rgb: 3个值 0 ~ 255 new Color(255,0,0);
//        //g.setColor(new Color(255,0,0));
//        g.setColor(Color.BLUE);
//        g.drawString("score: ",30,50);
//    }

    public static void main(String[] args) {

        //1.创建窗口对象
        JFrame win = new JFrame();
        //5.设置窗口标题
        win.setTitle("飞机大战");
        //3.设置窗口大小
        win.setSize(400,650);
        //6.居中显示
        win.setLocationRelativeTo(null);
        //7.设置窗口没有外边框
        //win.setUndecorated(true);
        //4.设置窗口的默认关闭选项 0 ~ 3
        win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //8.将画板添加到窗口上
        Window panel = new Window();
        win.add(panel);

        //画板对象
        Draw draw = new Draw();
        //把画板添加到窗口
        win.add(draw);

        draw.action();
        //2.显示窗口
        win.setVisible(true);

    }
}
